package com.share.homestay.hystrix;

import com.share.homestay.entity.HostelOrders;
import com.share.homestay.entity.OrderOperationLogs;
import com.share.homestay.pojo.JsonResult;
import com.share.homestay.service.HostelOrdersServiceFeign;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class HostelOrdersServiceHystrix implements FallbackFactory<HostelOrdersServiceFeign> {
    @Override
    public HostelOrdersServiceFeign create(Throwable cause) {
        return new HostelOrdersServiceFeign() {
            @Override
            public JsonResult findAllHostelOrders(HostelOrders hostelOrders, Long pageNum, Long pageSize) {
                throw new RuntimeException("调用分页查询全部订单时出现异常");
            }

            @Override
            public JsonResult findOrderOperationLogs(String id, Long pageNum, Long pageSize) {
                throw new RuntimeException("调用分页查询订单操作日志时出现异常");
            }

            @Override
            public Long addOrderOperationLog(OrderOperationLogs orderOperationLogs) {
                throw new RuntimeException("运行添加订单操纵日志时出现异常");
            }
        };
    }
}
